package cn.hongwei.eduservice.entity;

import cn.hongwei.service.base.model.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 课程科目
 * </p>
 *
 * @author Great
 * @since 1224028994@qq.com
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("edu_subject")
@ApiModel(value="Subject对象", description="课程科目")
public class Subject extends BaseEntity {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "类别名称")
    private String title;

    @ApiModelProperty(value = "父ID")
    //@TableField("parent_id")
    private String parentId;

    @ApiModelProperty(value = "排序字段")
    private Integer sort;
    // 一级分类用来存自己的二级分类的集合: 在表中没有对应的字段，所以查询时会报错
    // 给mybatisplus 忽略当前属性
    @TableField(exist = false) //exist表示当前字段是不是数据库中的，false表示不是
    private List<Subject> children = new ArrayList<>();
}
